#include "AbstractMobileObject.hpp"
#include <iostream>
Vector2D* AbstractMobileObject::computeTranslation(Vector2D *v)
{
    Vector2D *m = new Vector2D();
    *m = *m_linearMove + *v;

    double lSpeed = m->length();
    if (lSpeed < 0)
        lSpeed = 0;
    else if (lSpeed > m_maxLinearAcceleration)
        lSpeed = m_maxLinearAcceleration;

    if (m->length()>0)
        m->normalize();

    *m = *m / 0.5;

    return m;
}

double AbstractMobileObject::computeRotation(double a)
{
    if (a < -m_maxAngularAcceleration)
        return -m_maxAngularAcceleration;
    else if (a > m_maxAngularAcceleration)
        return m_maxAngularAcceleration;
    return a;
}

void AbstractMobileObject::move(double x, double y)
{
    m_posx += x;
    m_posy += y;
}

void AbstractMobileObject::rotate(double rotation)
{
    m_angle += rotation;
}

